// formPackage/pages/appointment/appointmentList/appointmentList.js
import { queryMyBookingList } from "../../../../service/book_service"
let app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    themeStyle: "",
    dataList: [

    ],
    page: 0,
    pageSize: 100,
    /**
     * bookingStatus
     * 1:预约中。。。
     * 2:预约成功
     * 3:预约失败...
     */

  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },


  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    if (app.globalData.themeStyle) {
      this.setData({
        themeStyle: app.globalData.themeStyle
      })
    }
    this.queryMyBookingList();
  },
  //获取预约列表
  queryMyBookingList() {
    wx.showLoading();
    queryMyBookingList(this.data.page, this.data.pageSize).then(res => {
      wx.hideLoading();
      console.log("JJLog:预约列表是:" + JSON.stringify(res));
      if (res.code == 200) {
        this.setData({
          dataList: res.data || []
        })
      }
    }).catch(err => {
      console.error("JJLog:查询失败", err);
      wx.hideLoading();
      wx.showToast({
        title: err || "查询失败",
        icon: "none"
      }, 3500)
    })
  },



  pushToPublish() {
    wx.navigateTo({
      url: '/formPackage/pages/appointment/myAppointment/myAppointment',
    })
  },




})